﻿Imports VMWorkshop.Domain

Partial Public Class Demo
    Private _vm As DemoViewModel

    Public Sub New()
        InitializeComponent()
    End Sub

    Sub Demo_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles Me.Loaded
        Me._vm = New DemoViewModel(New ProductRepository())
        Me.DataContext = Me._vm
    End Sub

    Private Sub productGrid_SelectionChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
        Me._vm.GetSelectedProduct((DirectCast(e.AddedItems(0), ProductListView)).ProductId)
    End Sub

    Private Sub saveButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Me._vm.Persist()
    End Sub

End Class
